package com.goodving.guli.utility;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Environment;
import android.telephony.TelephonyManager;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Created by Administrator on 2015/11/17 0017.
 */
public class C1467i {
    public static final String f6153a;
    public static final int f6154b = 1073741824;
    public static final int f6155c = 67108864;
    public static final int f6156d = 50;
    private static String f6157e;
    private static String f6158f;

    static {
        f6153a = C1467i.class.getSimpleName();
        f6157e = null;
        f6158f = null;
    }

//    public static String m11957a(String str) {
//        Exception e;
//        Throwable th;
//        BufferedReader bufferedReader = null;
//        BufferedReader bufferedReader2;
//        try {
//            bufferedReader2 = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec("getprop " + str).getInputStream()), StatsCircleView.MSG_CHANGE_COLOR);
//            try {
//                String readLine = bufferedReader2.readLine();
//                bufferedReader2.close();
//                if (bufferedReader2 == null) {
//                    return readLine;
//                }
//                try {
//                    bufferedReader2.close();
//                    return readLine;
//                } catch (Exception e2) {
////                    C1472m.m12014a(f6153a, "Exception while closing InputStream", e2);
//                    return readLine;
//                }
//            } catch (IOException e3) {
//                e = e3;
//                try {
////                    C1472m.m12014a(f6153a, "Unable to read sysprop " + str, e);
//                    if (bufferedReader2 != null) {
//                        try {
//                            bufferedReader2.close();
//                        } catch (Exception e4) {
////                            C1472m.m12014a(f6153a, "Exception while closing InputStream", e4);
//                        }
//                    }
//                    return null;
//                } catch (Throwable th2) {
//                    th = th2;
//                    bufferedReader = bufferedReader2;
//                    if (bufferedReader != null) {
//                        try {
//                            bufferedReader.close();
//                        } catch (Exception e22) {
////                            C1472m.m12014a(f6153a, "Exception while closing InputStream", e22);
//                        }
//                    }
//                    throw th;
//                }
//            }
//        } catch (IOException e5) {
//            e4 = e5;
//            bufferedReader2 = null;
////            C1472m.m12014a(f6153a, "Unable to read sysprop " + str, e4);
//            if (bufferedReader2 != null) {
//                bufferedReader2.close();
//            }
//            return null;
//        } catch (Throwable th3) {
//            th = th3;
//            if (bufferedReader != null) {
//                bufferedReader.close();
//            }
//            throw th;
//        }
//    }

    public static boolean m11958a(Context context) {
        return ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)).hasIccCard();
    }

    public static int m11959b(Context context) {
        PackageInfo packageInfo = null;
        try {
            packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
        } catch (PackageManager.NameNotFoundException e) {
        }
        if (packageInfo == null) {
            return 1;
        }
        return packageInfo.versionCode;
    }

//    public static String m11956a() {
//        if (f6157e == null) {
//            String str = C1481u.getContext().getFilesDir().getAbsolutePath() + File.separator + "ledongli";
//            File file = new File(str);
//            if (!file.exists()) {
//                file.mkdir();
//            }
//            f6157e = str;
//        }
//        return f6157e;
//    }

    public static boolean m11960b() {
        if (Environment.getExternalStorageState().equals("mounted")) {
            return true;
        }
        return false;
    }

    public static String m11961c() {
        if (f6158f == null) {
            try {
//                f6158f = C1481u.getContext().getPackageManager().getPackageInfo(C1481u.getContext().getPackageName(), 0).versionName;
            } catch (Exception e) {
            }
        }
        return f6158f == null ? "" : f6158f;
    }

    public static String m11962d() {
        SharedPreferences d = C1481u.m12082d();
        String string = d.getString(C1465g.f6115O, null);
        if (!C1478r.m12046a(string)) {
            return string;
        }
        string = ((TelephonyManager) C1481u.getContext().getSystemService("phone")).getDeviceId();
        if (C1478r.m12046a(string)) {
            string = C1478r.m12045a(7);
        }
        SharedPreferences.Editor edit = d.edit();
        string = "an" + C1473n.m12019a(string);
        edit.putString(C1465g.f6115O, string);
        edit.commit();
        return string;
    }

    public static String m11963e() {
        return Build.MANUFACTURER;
    }

    public static String m11964f() {
        return Build.VERSION.RELEASE;
    }

    public static String m11965g() {
        return Build.MODEL;
    }

    public static String m11966h() {
        return Build.BRAND;
    }

    public static String m11967i() {
        return Build.BOARD;
    }

    public static String m11968j() {
        return Build.DISPLAY;
    }

//    public static boolean m11969k() {
//        ApplicationInfo applicationInfo = C1481u.getContext().getApplicationContext().getApplicationInfo();
//        if ((applicationInfo.flags & f6154b) != 0 || (applicationInfo.flags & f6155c) != 0) {
//            return false;
//        }
//        if (VERSION.SDK_INT > 18) {
//            try {
//                AppOpsManager appOpsManager = (AppOpsManager) C1481u.getContext().getSystemService("appops");
//                if (((Integer) Class.forName("android.app.AppOpsManager").getDeclaredMethod("checkOpNoThrow", new Class[]{Integer.TYPE, Integer.TYPE, String.class}).invoke(appOpsManager, new Object[]{Integer.valueOf(f6156d), Integer.valueOf(applicationInfo.uid), C1481u.getContext().getPackageName()})).intValue() != 0) {
//                    return false;
//                }
//            } catch (Exception e) {
//                e.printStackTrace();
//            }
//        }
//        return true;
//    }

//    public static String m11970l() {
//        return Build.MODEL + "/" + Build.VERSION.RELEASE + "/W" + C1467i.m11961c() + " " + C1481u.m12082d().getInt(C1465g.f6117Q, 0);
//    }
}
